<template>
    <h1>Key属性添加到v-for中</h1>
    <div v-for="(item, index) in list" :key="index">
        {{ item.name }} {{ item.age }}
    </div>
</template>

<script>
export default {
    data() {
        return {
            list: [
                { id: 1, name: '张三', age: 18 },
                { id: 2, name: '李四', age: 19 },
                { id: 3, name: '王五', age: 20 },
                { id: 4, name: '赵六', age: 21 }
            ]
        }
    }
}
</script>